package com.junzhiit.nengji.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum IdentityType {
	
	COMMON(0,"普通用户"),
	VIP_USER(1,"VIP会员"),
	CHANNEL_PARTNER(2,"渠道合伙人");
	
	private Integer type;
	
	private String value;

	private IdentityType(Integer status,String value){
		this.type = status;
		this.value = value;
	}

	public int toIntType() {
		return this.type;
	}
	
	public String toStringValue() {
		return this.value;
	}

	public static IdentityType toFlag(int type) {
		if (COMMON.type == type) {
			return COMMON;
		} else if (VIP_USER.type == type) {
			return VIP_USER;
		} else if (CHANNEL_PARTNER.type == type) {
			return CHANNEL_PARTNER;
		} else {
			throw new InvalidArgumentException("Unknown type[" + type + "].");
		}
	}
}
